<%@ page language="java"  pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%
String path = request.getContextPath();
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="<%=path %>/styles/main.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<%=path %>/js/main.js"></script>
<script type="text/javascript" src="<%=path%>/js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="<%=path%>/js/jquery.form.js"></script>
<script type="text/javascript">
	function save(){		
		var selPris="";
		var priObj=document.getElementById('usedPri');
		for(var i=0;i<priObj.options.length;i++){
			selPris = selPris+","+priObj.options[i].value;			
		}
		document.getElementById("selPris").value=selPris;
		
	    var form = $("form[name=roleForm]"); 
        var options = {success:showResponse,resetForm:false,dataType:'script'};
        form.ajaxSubmit(options);       
        return;   
	}
	function showResponse(data){//回调函数
	    if(1 == data){
	    	document.getElementById("MsgDiv").innerHTML="保存成功！";
	    	parent.loadPage();	     
	    }else{
	        document.getElementById("MsgDiv").innerHTMNL="操作失败";
	    }
	}
</script>
</head>
<body>
<form id="roleForm" name="roleForm"  method="post" action="<%=path %>/system/role/save.do"> 
<div id="DetailContent">	
	<table width="100%" border="0" cellspacing="2" cellpadding="2"  class="TableForm">
	  <tr>
		<td  nowrap="nowrap" width="80">角色名称：</td>
		 <td class="NTbsM">
		 	<input name="roleId" type="hidden" value='<s:property value="role.roleId"/>'/>
		 	<input name="roleName" type="text" value='<s:property value="role.roleName"/>' class="InputText" onfocus="this.className='InputTextDown'" onblur="this.className='InputText'" />
		 </td>
	  </tr>
	  <tr>
		<td>角色描述：</td>
		<td><textarea name="roleDesc" rows="5" class="InputText" onfocus="this.className='InputTextDown'" onblur="this.className='InputText'" ><s:property value="role.roleDesc"/></textarea></td>
	  </tr>	  
	</table>
	<!--角色权限-->
	<fieldset style="-moz-border-radius:8px;">
		<legend>选择角色权限</legend>
		<table width="100%" border="0" cellspacing="0" cellpadding="0"  align="center" >
		 <tr>
		    <td width="220"><select id="allPri" name="allPri" multiple="true" class="multi_Select" >
				  <s:iterator value="priAllList">
						<option value="<s:property value="resId"/>"><s:property value="resName"/></option>
				  </s:iterator> 
				</select>
			</td>
			<td width="60">
				<input name="btnMoveRight" type="button" class="arrowRGo" onClick="moveSelected(document.getElementById('allPri'),document.getElementById('usedPri'))" /><br /><br />
				<input name="btnMoveLeft" type="button" class="arrowLGo" onClick="moveSelected(document.getElementById('usedPri'),document.getElementById('allPri'))" />
			</td>
			<td width="220"><input type="hidden" name="selPris" id="selPris"/>
				<select id="usedPri" name="usedPri" multiple="true" class="multi_Select" >
				   <s:iterator value="priUsedList">
						<option value="<s:property value="resId"/>"><s:property value="resName"/></option>
				   </s:iterator> 
				 </select>
			</td>
		 </tr>
     </table>
	</fieldset>
	
</div>  
<!--工具按钮-->
<div  id="FormToobar" style="margin:0 5px; border: solid 1px #6d6d6d;">
	<div id="MsgDiv" style="float:left"></div>
	<div style="float:right">
	    <tt><input name="保存23" type="button" class="But" value="保存" onclick="save()"/> </tt>
	    <tt><input name="返回23" type="button" class="But" value="返回" onclick="parent.ymPrompt.close();" /></tt>
    </div>	
</div>
</form>
</body>
</html>
